<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var arr = [43,56,45,77,87,98,57,33];
        var max = 0;
        var min = 100;
        var max_index = 0;
        var min_index = 0;
        for(var i = 0;i<arr.length;i++){
            if(arr[i] > max){
                max = arr[i];
                max_index = i;
            }
            if(arr[i] < min){
                min = arr[i];
                min_index = i;
            }
        }
        console.log("下标为" + max_index + "的是最大值" + max);
		console.log("下标为" + min_index + "的是最小值" + min);
    </script>
</head>
<body>
    
</body>
</html>